Learning Objectives

By the end of this 90-minute session, students will be able to:

  1. Define and plot univariable functions in R for economic applications
  2. Define and plot multivariable functions in R for business optimization
  3. Solve linear equation systems using matrix notation and operations
  4. Analyze quadratic functions and positive definite matrices with their graphical representations

R skills

  1. Define a function using the R key word function()
  2. Define a function using a function as input
  3. 3D visualisation of multivariable functions

Knowledge Point 1: Defining and Plotting Univariable Functions in R

Example 2.1: The Coffee Shop Economics

Bean & Brew Café wants to optimize its operations using mathematical modeling. The owner needs to understand:

  1. Production function: \(Q(L) = 10\sqrt{L}\) (cups per hour vs labor hours)
  2. Cost function: \(C(Q) = 50 + 2Q + 0.1Q^2\) (total cost vs output)
  3. Revenue function: \(R(Q) = 5Q - 0.05Q^2\) (revenue vs quantity sold)
  4. Profit function: \(\Pi(Q) = R(Q) - C(Q)\) (profit optimization)

The owner asks: “How can I use R to visualize these relationships and find the optimal production level?”

In R, functions can be defined using several approaches:

Method 1: Vectorised operations in R

By vectorised operation we mean the variable \(x\) is a sequence of real numbers as we did in the previous section. In mathematics we call such \(x\) a vector. Vectorised operation creates a new sequence \(y\). It matches to each number in the sequence of \(x\) a number in the new sequence of \(y\).

R code for a function defined by vectorised operation is like follows, which we have used in the previous section.

x <- seq(from, to, by = step)
y <- expression_in_x

Method 2: Using function() keyword

R code using function() is like follows:

f <- function(x) {
  return(expression_in_x)
}

For \[y = 0.5x + 2\]

The following R code defines the function and plot its graph.

f <- function(x) {
  return(0.5*x+2)
}
x <- seq(-4,8,1)
y <- f(x)

plot(x, y, type = "l", main = "Linear Function Y = 0.5 X + 2", xlab = "X", ylab = "Y")

Often the vectorized operation method is simple but it is less flexible and in some situation it is not applicable.

Example 1.2 The delivery service (revisited)

The price is a piece-wise linear function.

\[C(d) = \begin{cases} 10 & \text{if } 0 \leq d \leq 5 \\ 10 + 2(d-5) & \text{if } 5 < d \leq 15 \\ 10 + 20 + 1.5(d-15) & \text{if } d > 15 \end{cases}\]

In this case we can only use function() to define the price function in R.

C<-function(d){
  if ((d>0)&( d <= 5))  {price<-10}
  if ((d>5)&( d <= 15)) {price<- 10 + 2*(d-5)}
  if (d>15)             {price <- 10 + 20 + 1.5*(d-15)}
  return(price)
}

d<- seq(1,30)
P<-d*0
# here we cannot do P <- D(d) because the condition in function C(d) refers d as a single number not sequence. 
# hence we match each component of P to the corresponding component of d one by one
for (i in 1:length(d)) {
  P[i] = C(d[i])
}

plot(d,P,type = "l", main = "Price of Delevery", 
     xlab = "Distance in KM", ylab = "Price")

Exercise

Use R keyword function() to define the following function and draw its graph over the domain of [0,10] in following R Environment or in your own local RStudio. You can copy the sample code above and modify it to define the function.

\[f(x) = \begin{cases} 2x & \text{if } 0 \leq x \leq 5 \\ 10 + 4(x-5) & \text{if } 5 < x \\ \end{cases}\]

Plot a function using the function as input

R function() allows more types of input than real numbers. We take function as input to generate a desired output. In this sense function() extends the concept of real functions. Here is an example of how to define a Plot function that takes a function and a vector variable as input, and gives the graph of the function over the domain given by the vector as output.

Plot_function <- function(f,x) {
  y <- f(x)
  plot(x,y,type="l")
}

### note: Plot_function can be used to plot any function of $x$. See following two  examples

## we define a function Line_point_slope: this function goes through the point (x0,y0) with a slope equals b
x0 = 3
y0 = 4
b  = 2
Line_point_slope <- function(x){
  y = y0 + b*(x-x0)
  return(y)
}

## we define a function Polynomial3: this polynomial is of order 3 

Polynomial3 <- function(x){
  y = x^3+2*x^2-4*x-1
  return(y)
}


x <- seq(0,10,0.1)
Plot_function(Line_point_slope,x)

Plot_function(Polynomial3,x)

Exercise

Use R keyword function() to define a function that use a yet to be specified function \(f\) as input and draw the graphs of \(f\) over a subset of the domain of \(f\) in the following R Environment or in your own local RStudio. Then specify different function \(f\) and draw the graph of \(f\).

  • A linear function that goes through a point \((x_0,y_0)= (2,3)\) and has the slope \(b=1.5\).

  • \(f(x) = \sin(2x)\),

  • \(f(x)=\frac{1}{1+e^-x}\),

  • \(f(x) =\frac{x^3+1}{5+x^2}\))

The R code of the two graphs above can be used as a template to complete this exercise.


Knowledge Point 2: Define and Plot Multivariable Functions in R

Example 2.2: The Tech Company’s Strategic Planning

InnovateTech Corp is optimizing its operations across multiple dimensions:

  1. Utility Function: \(U(x,y) = x^{0.6}y^{0.4}\) (consumer satisfaction from products x and y)
  2. Profit Function: \(\Pi(p_1,p_2) = (p_1-10)q_1 + (p_2-15)q_2\) where \(q_i = 100-2p_i\) (profit from two products)
  3. Production Function: \(Q(L,K) = 20L^{0.7}K^{0.3}\) (output from labor L and capital K)

The CEO asks: “How can we visualize these multivariable relationships in R to make better strategic decisions?”

Definition 2.1: Multivariable Function

A function \[f : \mathbb{R}^n \to \mathbb{R}\] is called a multivariable function if it maps multiple inputs \((x_1,x_2,...,x_n)\) to a real number \(f(x_1,x_2,...,x_n)\).

Example of a linear function \[f(x,y) = x + 2y - 4\] Thsi function takes two inputs \(x\) and \(y\) and return a value that depends lienarly on \(x\) and \(y\).

Example of a quadratic function \[f(x,y) =x^2+y^2\] This function takes two inputs \(x\) and \(y\) and returns their squared sum. This is a function of two variables.

Multivariable Function in R

f<-function(x,y){
  return(x^2+y^2)
}

In plotting a univariable function \(y = f(x)\),

    1. we create a sequence of values for the input variable \(x\)
    1. we calculate the values of the output variable \(y\) corresponding to each input variable value.
    1. Then we plot these pairs of \((x,y)\) in the coordinate system and connect them with lines.

In plotting a multivariable function \(z=f(x,y)\) we follow the same procedure.

    1. we create a sequence of values for each input variable \(x\) and \(y\) respectively,
    1. we calculate the value of the output variable \(z\) corresponding to each pair of input values.
    1. Then we plot the triple \((x,y,z)\) in the 3D space of the coordinate system and connect them with lines (surfaces).

Visualise linear functions

\[f(x,y) = x+ 2y -4\] A function of two variables can be visualised as a surface over in a 3D coordinate system, where \((x,y)\) are the input variables and \(z\) is the value of the output variable. For the linear function the surface will be a plane.

As in the case of univariate functions, we create sequences for the input variables \(x\) and \(y\). For each pair \((x,y)\) we calculate the function value \(z=f(x,y)\). The resulting \(z\)-values are then connected to form the surface.

Surface plot

x <- seq(-10, 10, length.out = 30)
y <- seq(-10, 10, length.out = 30)

f <- function(x, y) { Q <- x + 2*y - 4 }
z <- outer(x, y, f)

#op <- par(bg = "white")
persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue")

Contour Plot

One often used visualisation of a multivariable function is the contour plot. The following link shows a contour plot of Snowing Mountain in googlemap.

https://www.google.com/maps/place/Snowy+Mountains/@-36.5044076,148.3164928,14.6z/data=!4m6!3m5!1s0x6b234b038cf2dd5d:0x5e23945ff8d761b8!8m2!3d-36.5!4d148.3333333!16zL20vMDc0d20!5m2!1e4!1e3?entry=ttu&g_ep=EgoyMDI1MDgyNS4wIKXMDSoASAFQAw%3D%3D

Rice fields on hills create contour lines (level lines) in the landscape. Since rice needs water, the ridges around the fields must be kept even.

Rise field and Isoquants
Rise field and Isoquants

The lines of seats in a stadium are similar to the contour lines of a plane.

Along the contour line the height is a constant, therefore contour lines are also called level lines. They are also known as isoquants. Perpendicular to the contour lines is the direction of the steepest descending or ascending.

contour(x, y, z, nlevels = 20)

Station stairs and Isoquants
Station stairs and Isoquants

Heat map

Heat map
Heat map

Heat map is often used in weather forecast to visualise the the temperature function over an area. It is a function of two variables the longitude and the latitude. The color corresponds to the function value, the temperature.

For the linear function in the exampl:

filled.contour(x, y, z)

Gradient fieled

While the heat map with contour lines show the along which direction the surface is more flat, it shows at same time that the direction perpendicular to the contour lines is the direction of ascending of descending. Gradient field is a plot that shows which direct is the most ascending direction at each point with an arrow.

plot(1, type = "n", xlim = range(x), ylim = range(y),
     xlab = "Labor (L)", ylab = "Capital (K)",
     main = "Gradient Field of Q(L,K)")


# Define partial derivatives (gradient components)
dQ_dx <- function(x, y) {
  1  # ∂Q/∂L
}

dQ_dy <- function(x, y) {
  2  # ∂Q/∂K
}


for(l in x) {
  for(k in y) {
    arrows(l, k, 
           l + dQ_dx(l, k)/8, 
           k + dQ_dy(l, k)/8,
           length = 0.04, col = "blue")
  }
}

On a plane, the direction of maximum ascent is the same everywhere; therefore, the arrows are identical at each point.

Interactive surface

Interactive surface plot allows to see the 3D object from different perspective and make it a “real” 3D plot.

library(plotly)
plot_ly(x = x, y = y, z = z, type = "surface")

Slice

Slice is a 2D plot generated by assigning other input variables some constant values. In this way the function value depends only on one input variable. This method is oftne used in ecomonics to investigate the impact on one paritcula variables on the multivariable function.

# --- Slice Plot ---
plot(x, f(x, y = 0), type = "l", col = "blue", lwd = 2,
     xlab = "Labour (L)", ylab = "Output", main = "Slice of Production Function (y = 0,2,4)")
lines(x, f(x, y = 2), col = "red", lwd = 2)
lines(x, f(x, y = 4), col = "green", lwd = 2)
legend("bottomright", legend = c("K = 0", "K = 2","K = 4"), col = c("blue", "red","green"), lwd = 2)

Visualisation of Nonlinear Functions

\[Q(L,K)=20x^{0.7}y^{0.3}\]

Surface plot

L <- seq(0, 10, length.out = 30)
K <- seq(0, 10, length.out = 30)

f <- function(L, K) { Q <- 20*L^0.7*K^0.3 }
z <- outer(L, K, f)

#op <- par(bg = "white")
persp(L, K, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue")

Contour Plot

contour(L, K, z, nlevels = 20)

Heat Map

filled.contour(L, K, z)

Gradient Field

# Define partial derivatives (gradient components)
dQ_dL <- function(L, K) {
  20 * 0.7 * L^(-0.3) * K^0.3  # ∂Q/∂L
}

dQ_dK <- function(L, K) {
  20 * 0.3 * L^0.7 * K^(-0.7)  # ∂Q/∂K
}


plot(1, type = "n", xlim = range(L), ylim = range(K),
     xlab = "Labor (L)", ylab = "Capital (K)",
     main = "Gradient Field of Q(L,K)")

for(l in L) {
  for(k in K) {
    arrows(l, k, 
           l + dQ_dL(l, k)/100, 
           k + dQ_dK(l, k)/100,
           length = 0.04, col = "blue")
  }
}

In a gradient field plot, the direction of an arrow points to the direction of ascent, and the length of the arrow indicates the steepness of that ascent. The longer the arrow, the steeper the ascent.

Interactive surface

library(plotly)
plot_ly(x = L, y = K, z = z, type = "surface")

Slice

# --- Slice Plot ---
plot(L, f(L, K = 5), type = "l", col = "blue", lwd = 2,
     xlab = "Labour (L)", ylab = "Output", main = "Slice of Production Function (K = 5)")
lines(L, f(L, K = 2), col = "red", lwd = 2)
lines(L, f(L, K = 1), col = "green", lwd = 2)
legend("bottomright", legend = c("K = 5", "K = 2","K = 1"), col = c("blue", "red","green"), lwd = 2)

Visualization Techniques

  1. Surface plots: Show the 3D shape of the function
  2. Contour plots: Show level curves (isoquants, indifference curves)
  3. Heat maps: Color-coded representation of function values
  4. Gradient field: Show the direction and steepness of ascent at each point
  5. Cross-sections: 2D slices of the 3D function

Economic Interpretations

  • Isoquants: Curves of constant output in production functions
  • Indifference curves: Curves of constant utility
  • Iso-profit curves: Curves of constant profit
  • Gradients: Direction of steepest increase

Exercise

Visualise the following functions using surface plot, contour plot, heat map, slice, and 3D interactive surface plot.

  • a plane that goes through \((x_0,y_0) = (2,3)\) with slope a=1.5 in x direct and slope b=3 in y direction. (Hint: the plane function is \(f(x,y) = f(x_0,y_0) + a(x-x_0) + b(y-y_0)\)

  • \(f(x,y) = x^2+y^2\)

using the following R Environment or your own local RStudio.

Interactive Quiz 2.2

Knowledge Point 3: Linear Equation Systems and Matrix Notation

Example 1.4: The Market Equilibrium (Revisited)

Finding where supply equals demand:

  • Supply Function: Q = -100 + 2P (suppliers willing to sell)
  • Demand Function: Q = 300 - P (consumers willing to buy)

This requires us to solve this system of two linear equations at the same time.

Example 2.3: The Manufacturing Company

TechProd Manufacturing produces three products: smartphones (S), tablets (T), and laptops (L). The company needs to determine optimal production levels based on resource constraints.

Resource Requirements per Unit:

  • Labor hours: 2S + 3T + 4L = 1000 hours available

  • Materials (kg): 1S + 2T + 3L = 600 kg available

  • Machine time: 3S + 1T + 2L = 800 hours available

This real-world problem naturally required us to solve this system of 3 linear equations at same time.

How do we want to proceed? Recall how we solve a single linear equation:

\[ax+b=0\] Procedure:

Step 1: Move the unknown to the right hand side and the known to the left hand side. \[ax = -b\] Step 2: Multiply the inverse of the coefficient \(a\) to both side of the equation.

\[a^{-1}ax = a^{-1}(-b)\] This leads the thesolution: \[x = -a^{-1}b\] For \(a=3\) and \(b=2\), R solution is as follows:

a = 3
b = 2

-solve(a)*b
##            [,1]
## [1,] -0.6666667

Can we follow the same procedure to solver a system of linear equations? The answer is yes. Here is how.

Example 2.4: The Manufacturing Company

step 1: Move all unknowns to the left and side of the equation and the knowns to the right hand side of the equation, and arrange the unknown variables in the same order: i.e. \(S\) first, \(T\) second, and \(L\) third

\[2S + 3T + 4L = 1000\] \[1S + 2T + 3L = 600\] \[3S + 1T + 2L = 800\] step 1.1

Put all unkonwns into one sequence as a vector \(X=\left( \begin{array}{c} S\\ T\\ L\\ \end{array} \right)\)

and the knowns on the right hand side as a vector \(b=\left( \begin{array}{c} 1000\\ 600\\ 800\\ \end{array} \right)\)

step 1.2

Put the coefficients of the equation system into a matrix;

\(A=\left( \begin{array}{ccc} 2&3&4\\ 1&2&3\\ 3&1&2\\ \end{array} \right)\)

Note the for a 3 equations system, we have 3 unknowns, i.e. \(X\) has 3 elements: \(X=\left( \begin{array}{c} S\\ T\\ L\\ \end{array} \right)\); the right hand side knowns \(b\) also has 3 elements: \(b=\left( \begin{array}{c} 1000\\ 600\\ 800\\ \end{array} \right)\);

the coefficient matrix is a \(3 \times 3\) square matrix, the values in the matrix correspond to their positions in the three equations. ( This is why the order of the variables in the equation is sensitive.)

\[\underbrace{\left( \begin{array}{rrr} 2 & 3 & 4\\ 1 & 2 & 3\\ 3&1 & 2\\ \end{array} \right)}_{A} \underbrace{\left( \begin{array}{c} S\\ T\\ L\\ \end{array} \right)}_{X} = \underbrace{\left( \begin{array}{r} 1000\\ 600\\ 800\\ \end{array} \right)}_{b} \]

Step 2 Multiply the inverse of the coefficient \(A\) to both side of the equation

\[A^{-1}AX = A^{-1}b\] This leads to the solution \(A^{-1}A=I\):

\[X = A^{-1}b\]

R solution is as follows:

A <- matrix(c(2,3,4,1,2,3,3,1,2),3,3,byrow = TRUE)
b <-c(1000,600,800)

solve(A)%*%b
##              [,1]
## [1,] 2.000000e+02
## [2,] 2.000000e+02
## [3,] 5.684342e-14
# %*% is the symbol of matrix multiplication in R.
# *   is the symbol of real number multiplication. 

The solution is \(S=200\), \(T=200\), and \(L=0\).

Example 1.4: The Market Equilibrium (Revisited)

  • Supply Function: Q = -100 + 2P
  • Demand Function: Q = 300 - P

After moving the unknowns to the left hand side, We have in matrix form:

\[\underbrace{\left( \begin{array}{rr} 1 & -2 \\ 1 & 1 \\ \end{array} \right)}_{A} \underbrace{\left( \begin{array}{c} Q\\ P\\ \end{array} \right)}_{X} = \underbrace{\left( \begin{array}{r} -100\\ 300\\ \end{array} \right)}_{b} \]

R solution

A = matrix(c(1,-2,1,1),2,2,byrow=TRUE)
b = c(-100,300)
solve(A)%*%b
##          [,1]
## [1,] 166.6667
## [2,] 133.3333
# %*% is the symbol of matrix multiplication in R.
# *   is the symbol of real number multiplication. 

This is exactly the same solution we have obtained by substitution method in the previous section.

Existence of one solution, infinitly mand solutions and no solution

  • One solution: Two line cross each other: there is one solution \(\Leftrightarrow\)\(A\) is invertible \(\Leftrightarrow\) the slopes are different.
  • Infinitely many solutions: There is only one line. \(A\) is not invertible\(\Leftrightarrow\) slopes and intercepts are the same \(\Leftrightarrow\) the rows including the constants are proportional.
  • No solution: Two lines are parallel to each other, \(A\) is not invertible \(\Leftrightarrow\) the slopes are the same but the intercepts are different \(\Leftrightarrow\) The rows of \(A\) are proportional but not the constants.
Existence of solutions
Existence of solutions

Exercise

Solve the market equilibrium problem

  • Supply Function: Q = -80 + 2P
  • Demand Function: Q = 200 - 2P

above using R Environment below or using your own local RStudio.

Formal Presentation of Linear Equation Systems

Definition 2.2: Linear Equation System

A system of \(m\) linear equations in \(n\) unknowns has the form: \[\begin{cases} a_{11}x_1 + a_{12}x_2 + \cdots + a_{1n}x_n = b_1 \\ a_{21}x_1 + a_{22}x_2 + \cdots + a_{2n}x_n = b_2 \\ \vdots \\ a_{m1}x_1 + a_{m2}x_2 + \cdots + a_{mn}x_n = b_m \end{cases}\]

Matrix Representation

This system can be written compactly as: \(\mathbf{Ax} = \mathbf{b}\)

Where: - \(\mathbf{A} = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix}\) ,\(\hspace{0.5cm}\) \(\mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix}\) ,\(\hspace{0.5cm}\) \(\mathbf{b} = \begin{bmatrix} b_1 \\ b_2 \\ \vdots \\ b_m \end{bmatrix}\)

Solution

\[\mathbf{x} = \mathbf{A}^{-1}\mathbf{b}\]

Matrix and Vector Operations and Geometric Interpretation

We have been using vector operations to define a function in R Since last section. The example of solving linear equation systems using matrix notation demonstrates the usefulness of vector and matrix notations. Now we want to formalise these operations to see what kind other benefits these vector and matrix notation can give.

    1. Vector Addition:\((\mathbf{x}+\mathbf{b})_i = x_i+b_i\)
    1. Vector Multiplication with a Number:\((a\mathbf{x})_i = ax_i\)
    • Scaling and potential direction reversal. \(\mathbf{x}\) and \(\mathbf{y}\) are parallel if \(\mathbf{x}=a\mathbf{y}\).
    1. Inner Product of Two Vectors:\(\mathbf{x}'\mathbf{y} = \sum_{k=1}^nx_ky_k\)
    • Measuring alignment/projection between vectors. \(\mathbf{x}'\mathbf{y}=0\), or \(\begin{bmatrix} x_1 & x_2 \end{bmatrix}\begin{bmatrix} y_1 \\ y_2 \end{bmatrix}=0\) implies the two vectors are perpendicular to each other.
    1. Outer Product of Two Vectors:\(\mathbf{x}\mathbf{y}'_{i,j} = x_iy_j\)
    1. Matrix Addition: \((\mathbf{A} + \mathbf{B})_{ij} = a_{ij} + b_{ij}\)
    1. Matrix Multiplication: \((\mathbf{AB})_{ij} = \sum_{k=1}^{p} a_{ik}b_{kj}\)
    1. Matrix Multiplication With a Vector: \((\mathbf{Ax})_{i} = \sum_{k=1}^{n} a_{ik}x_{k}\) -From the rule of matrix and vector multiplication we know a linear equation system \[\begin{cases} a_{11}x_1 + a_{12}x_2 + \cdots + a_{1n}x_n = b_1 \\ a_{21}x_1 + a_{22}x_2 + \cdots + a_{2n}x_n = b_2 \\ \vdots \\ a_{m1}x_1 + a_{m2}x_2 + \cdots + a_{mn}x_n = b_m \end{cases}\] can be written as: \[\mathbf{Ax} = \mathbf{b} \]

Properties: - Associative: \((\mathbf{AB})\mathbf{C} = \mathbf{A}(\mathbf{BC})\) - Distributive: \(\mathbf{A}(\mathbf{B} + \mathbf{C}) = \mathbf{AB} + \mathbf{AC}\) - Not commutative: \(\mathbf{AB} \neq \mathbf{BA}\) (in general)

Two important relations between two vectors

  • Two vectors are parallel to each oether: \(\mathbf{x} = \lambda \mathbf{y}\) or \[\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}=\lambda \begin{bmatrix} y_1 \\ y_2 \end{bmatrix}\].

  • Two vectors are perpendicular to each other: \(\mathbf{x}'\mathbf{y} = 0\) or \[\begin{bmatrix} x_1 & x_2 \end{bmatrix} \begin{bmatrix} y_1 \\ y_2 \end{bmatrix}=0\].

Exercise

A vector with \(n\) elements is called an \(n\)-vector. An matrix with \(m\) rows and \(n\) columns is called an \(m\times n\)-matrix. Verify the following statement using the Matrix operation rules above.

  • Sum of two \(n\)-vectors is an \(n\)-vector.
  • An \(n\)-vector is an \(n\times 1\) matrix.
  • Inner product of two vectors is a number.
  • Outer product of an \(m\)-vector with an \(n\)-vector is an \(m\times n\) matrix.
  • Sum of two \(m\times n\) matrices is a \(m\times n\) matrix.
  • Product of an \(m\times n\) matrix and an \(n\times l\) matrix is an \(m\times l\) matrix.
  • Product of an \(m\times n\) matrix and an \(n\)-vector matrix is an \(m\)-vector.

Interactive Quiz 2.2


Inverse Matrix and Solving Linear Equation Systems

Formal Presentation

Definition 2.3: Matrix Inverse

For a square matrix \(\mathbf{A}\), the inverse matrix \(\mathbf{A}^{-1}\) satisfies: \[\mathbf{A}\mathbf{A}^{-1} = \mathbf{A}^{-1}\mathbf{A} = \mathbf{I}\]

where \(\mathbf{I}\) is the identity matrix.

Existence Conditions

\(\mathbf{A}^{-1}\) exists if and only if: 1. \(\mathbf{A}\) is square (\(n \times n\)) 2. \(\det(\mathbf{A}) \neq 0\) (A is non-singular)

Interpretation

  • Determinant ≠ 0: The system has a unique solution (feasible allocation)
  • Determinant = 0: Either no solution (impossible constraints) or infinite solutions (redundant constraints)

Geometric explanation: determinant=0 implies lines/planes are parallel.

  • Parallel line with different intercepts, there will be no intersection \(\to\) no solution.
  • Parallel line with same intercepts, two lines overlaps each other \(\to\) infinite solutions.

Computing the Inverse

Using pencil and paper for 2×2 matrices: \[\mathbf{A}^{-1} = \frac{1}{\det(\mathbf{A})} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}\] where \(\mathbf{A} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}\) and \(\det(\mathbf{A}) = ad - bc\)

For \(\mathbf{A} = \begin{bmatrix} 2 & 3 \\ 3 & 5 \end{bmatrix}\), we have following the formula: \(\mathbf{A}^{-1} = \begin{bmatrix} 5 & -3 \\ -3 & 2 \end{bmatrix}\),

Using R

### assign the matrix
A = matrix(c(2,3,3,5),2,2,byrow=TRUE)
### calculate the determinant
det(A)
## [1] 1
solve(A)
##      [,1] [,2]
## [1,]    5   -3
## [2,]   -3    2

Computation of an inverse matrix is doable with pencil and paper only for very small matrixes such as \(2\times 2\) matrices. For large matrices it is always done with computer.

Exercise

Calculate the determinant and the inverse of \(\mathbf{A} = \begin{bmatrix} 2 & 3 \\ 3 & 5 \end{bmatrix}\) using the following R Environment or your local RStudio.

Geometric illustration of existence of solution in linear equation system

  • One solution: three plane intersection at one point: there is a unique solution \(\Leftrightarrow\)\(A\) is invertible \(\Leftrightarrow\) the slopes of the planes are different.
  • Infinitely many solutions: one plane is redudant. \(A\) is not invertible\(\Leftrightarrow\) slopes and intercepts are the same for at least two planes \(\Leftrightarrow\) the rows including the constants are proportional.
  • No solution: Two planes are parallel to each other, \(A\) is not invertible \(\Leftrightarrow\) the slopes are the same but the intercepts are different for at least two planes\(\Leftrightarrow\) At least two rows of \(A\) are proportional but not the constants.

Interactive Quiz 2.3

Solving a nonlinear equation system

Solving a nonlinear equation system is a much more complicated task than solving a linear equation system. Following the geometric interpretation, one nonlinear equation with two variables is a curve on the (x,y) plane. A two equations system of two variables consists of two curves. If the two curves intersect all intersection points are solutions. We can use the following interactive graph to explore the solutions of a two nonlinear equations system of two variables.


Knowledge Point 4: Quadratic Functions and Positive Definite Matrices

In business and economics the following function is of particular interest \[f(x) = ax^2\]

Question: When is this function always positive (except at \(x=0\))? (e.g. the business activity will grantee a positive result)

Answer: When \(a > 0\)

This is the one variable case of positive definiteness: a function that always curves upwards and has a minimum at 0.

Extending this to multivariate cases, now consider \[f(\bf{x}) = \bf{x}'A \bf{x}= \sum_{i=1}^n\sum_{j=1}^n a_{i,j}x_ix_j\] where \(\bf{x}\) is a vector and \(A\) is a square \(n\times n\) matrix. This is the multivariate version of the scalar quadratic function. If this function is always positive except \(\bf{x=0\), then \(A\) is called positive definite.

Example 2.5: Hooke’s law and spring energy

In physics, the potential energy stored in a stretched spring is always positive (unless there’s no displacement):

\[ E = \frac{1}{2}\bf{x}'K\bf{x}\] where \(K\) is a stiffness matrix. For the system to make physical sense, energy must be positive \(\to\) \(K\) must be positive definite.

Example 2.6: The Investment Risk Analysis

Global Portfolio Management is analyzing investment risk using quadratic forms. The firm’s risk model for a two-asset portfolio is:

\[\text{Risk} = w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2w_1w_2\sigma_{12}\]

Where: + \(w_1, w_2\) are portfolio weights

  • \(\sigma_1^2, \sigma_2^2\) are asset variances

  • \(\sigma_{12}\) is the covariance between assets

This can be written as a quadratic form: \(\text{Risk} = \mathbf{w}^T\mathbf{\Sigma}\mathbf{w}\) with \(\mathbf{w}=\left( \begin{array}{c} w_1\\ w_2\\ \end{array} \right)\) and \(\mathbf{\Sigma} =\left(\begin{array}{cc} \sigma_1^2& \sigma_{12}\\ \sigma_{12}& \sigma_2^2\\ \end{array} \right)\)

The risk manager asks: “How can we determine if our covariance matrix ensures the risk is always positive (positive definite), and how do we visualize this?”

Definition 2.4: Positive Definite Matrices

A symmetric matrix \(\mathbf{A}\) is positive definite if: \[\mathbf{x}^T\mathbf{A}\mathbf{x} > 0 \text{ for all } \mathbf{x} \neq \mathbf{0}\]

Equivalent conditions:

  1. All eigenvalues of \(\mathbf{A}\) are positive

  2. All leading principal minors are positive

  3. \(\mathbf{A} = \mathbf{L}\mathbf{L}^T\) for some invertible matrix \(\mathbf{L}\) (Cholesky decomposition)

Calculation of eigen value in R

A<- matrix(c(2,1,1,3),2,2,byrow=TRUE)
A
##      [,1] [,2]
## [1,]    2    1
## [2,]    1    3
eigen(A)
## eigen() decomposition
## $values
## [1] 3.618034 1.381966
## 
## $vectors
##           [,1]       [,2]
## [1,] 0.5257311 -0.8506508
## [2,] 0.8506508  0.5257311

Graphical Properties

  • Positive definite:
    • Elliptical contours, unique minimum
    • Surface is bending upwards
# Create a grid over [-10, 10]
x <- seq(-10, 10, length.out = 100)
y <- seq(-10, 10, length.out = 100)

z <- outer(x, y, function(x, y) {
  mapply(function(x, y) {
    X <- c(x, y)
    t(X) %*% A %*% X
  }, x, y)
})

filled.contour(x, y, z)

Interactive surface

# --- Interactive 3D Surface ---
library(plotly)
plot_ly(x = x, y = y, z = z, type = "surface")

Negative Definite Matrices

A symmetric matrix \(\mathbf{A}\) is negative definite if: \[\mathbf{x}^T\mathbf{A}\mathbf{x} < 0 \text{ for all } \mathbf{x} \neq \mathbf{0}\]

All eigenvalues of \(\mathbf{A}\) are negative

Calculation of eigen value in R

A<- matrix(c(-2,1,1,-3),2,2,byrow=TRUE)
A
##      [,1] [,2]
## [1,]   -2    1
## [2,]    1   -3
eigen(A)
## eigen() decomposition
## $values
## [1] -1.381966 -3.618034
## 
## $vectors
##            [,1]       [,2]
## [1,] -0.8506508 -0.5257311
## [2,] -0.5257311  0.8506508

Graphical Properties

  • Negative definite:
    • Elliptical contours, unique maximum
    • the surface is beding downwards
# Create a grid over [-10, 10]
x <- seq(-10, 10, length.out = 100)
y <- seq(-10, 10, length.out = 100)

z <- outer(x, y, function(x, y) {
  mapply(function(x, y) {
    X <- c(x, y)
    t(X) %*% A %*% X
  }, x, y)
})


filled.contour(x, y, z)

Interactive surface

# --- Interactive 3D Surface ---
library(plotly)
plot_ly(x = x, y = y, z = z, type = "surface")

Exercise

For \(A =\begin{bmatrix} -4 & -1 \\ -1 & -6 \end{bmatrix}\) create 3D plots of the quadratic function \(f(\bf{x}) =\bf{x}'A\bf{x}\) over the domain of \(x_1 \in [-1,1]\),\(x_2\in [-1,1]\) using the following R environment of using your own local Rstudio.

Interactive Quiz 2.4


Comprehensive Review Questions

Level 1: Descriptive Understanding (Basic Concepts)

Question 1.1

Define a linear equation system and explain how it can be represented in matrix form. Give an example from business.

Sample Answer: A linear equation system consists of multiple linear equations with the same variables. It can be written as \(\mathbf{Ax} = \mathbf{b}\) where \(\mathbf{A}\) is the coefficient matrix, \(\mathbf{x}\) is the variable vector, and \(\mathbf{b}\) is the constant vector.

Business example: A company producing phones (P) and tablets (T) with constraints: - Labor: \(2P + 3T = 100\) hours - Materials: \(P + 2T = 60\) kg

Matrix form: \(\begin{bmatrix} 2 & 3 \\ 1 & 2 \end{bmatrix} \begin{bmatrix} P \\ T \end{bmatrix} = \begin{bmatrix} 100 \\ 60 \end{bmatrix}\)

Grading: 3 points for definition, 2 points for matrix representation, 5 points for business example.

Question 1.2

What is the difference between a composite function and an inverse function? Provide mathematical examples.

Sample Answer: - Composite function: \((g \circ f)(x) = g(f(x))\) - applying one function to the result of another - Inverse function: \(f^{-1}(f(x)) = x\) - “undoes” the original function

Examples: - Composite: If \(f(x) = x^2\) and \(g(x) = x + 1\), then \((g \circ f)(x) = x^2 + 1\) - Inverse: If \(f(x) = 2x + 3\), then \(f^{-1}(x) = \frac{x-3}{2}\)

Grading: 4 points for definitions, 3 points for composite example, 3 points for inverse example.

Question 1.3

Explain what makes a matrix positive definite and why this property is important in economics.

Sample Answer: A symmetric matrix \(\mathbf{A}\) is positive definite if \(\mathbf{x}^T\mathbf{A}\mathbf{x} > 0\) for all \(\mathbf{x} \neq \mathbf{0}\). Equivalently, all eigenvalues are positive.

Economic importance: - Portfolio risk: Covariance matrices must be positive definite to ensure risk is always positive - Utility functions: Negative definite Hessian ensures concave utility (diminishing marginal utility) - Cost functions: Positive definite Hessian ensures convex costs (increasing marginal costs)

Grading: 4 points for definition, 6 points for economic applications.

Question 1.4

Describe three different ways to visualize a multivariable function in R.

Sample Answer: 1. 3D Surface Plot: persp() or plot_ly() shows the function as a 3D surface 2. Contour Plot: contour() shows level curves (constant function values) 3. Heat Map: geom_tile() uses color intensity to represent function values

Each method reveals different aspects: surfaces show overall shape, contours show optimization paths, heat maps highlight regions of interest.

Grading: 3 points per visualization method, 1 point for comparative insight.

Question 1.5

What is the economic interpretation of the determinant of a coefficient matrix in a linear system?

Sample Answer: The determinant indicates whether the system has a unique solution: - det(A) ≠ 0: Unique solution exists (constraints are independent) - det(A) = 0: Either no solution (inconsistent constraints) or infinite solutions (redundant constraints)

In business: If det(A) = 0, the production constraints are either impossible to satisfy simultaneously or some constraints are redundant and can be eliminated.

Grading: 5 points for mathematical interpretation, 5 points for business context.

Question 1.6

Explain the relationship between exponential and logarithmic functions in the context of business growth.

Sample Answer: Exponential and logarithmic functions are inverses: - Exponential: \(N(t) = N_0 e^{rt}\) models growth over time - Logarithmic: \(t = \frac{\ln(N/N_0)}{r}\) finds time to reach target

Business application: If users grow as \(U(t) = 1000e^{0.1t}\), to find when we reach 5000 users: \(t = \frac{\ln(5000/1000)}{0.1} = \frac{\ln(5)}{0.1} \approx 16.1\) months.

Grading: 4 points for mathematical relationship, 6 points for business application.

Level 2: Operational Understanding (Calculation and Practice)

Question 2.1

Solve the following system using matrix inversion: \[\begin{cases} 3x + 2y = 14 \\ x + 4y = 18 \end{cases}\]

Sample Answer: Matrix form: \(\begin{bmatrix} 3 & 2 \\ 1 & 4 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 14 \\ 18 \end{bmatrix}\)

Step 1: Calculate determinant: \(\det(A) = 3(4) - 2(1) = 12 - 2 = 10\)

Step 2: Find inverse: \(A^{-1} = \frac{1}{10} \begin{bmatrix} 4 & -2 \\ -1 & 3 \end{bmatrix} = \begin{bmatrix} 0.4 & -0.2 \\ -0.1 & 0.3 \end{bmatrix}\)

Step 3: Solve: \(\begin{bmatrix} x \\ y \end{bmatrix} = A^{-1}b = \begin{bmatrix} 0.4 & -0.2 \\ -0.1 & 0.3 \end{bmatrix} \begin{bmatrix} 14 \\ 18 \end{bmatrix} = \begin{bmatrix} 2 \\ 4 \end{bmatrix}\)

Solution: \(x = 2, y = 4\)

Grading: 3 points for setup, 2 points for determinant, 3 points for inverse, 2 points for solution.

Question 2.2

Find the composite function \((f \circ g)(x)\) and its derivative if \(f(x) = \ln(x)\) and \(g(x) = x^2 + 1\).

Sample Answer: Step 1: Composite function: \((f \circ g)(x) = f(g(x)) = \ln(x^2 + 1)\)

Step 2: Derivative using chain rule: \(\frac{d}{dx}[(f \circ g)(x)] = \frac{d}{dx}[\ln(x^2 + 1)] = \frac{1}{x^2 + 1} \cdot \frac{d}{dx}[x^2 + 1] = \frac{2x}{x^2 + 1}\)

Grading: 5 points for composite function, 5 points for derivative calculation.

Question 2.3

A company’s profit function is \(\Pi(q) = 100q - 2q^2 - 500\). Find the profit-maximizing quantity and maximum profit.

Sample Answer: Step 1: Find critical point by setting derivative to zero: \(\frac{d\Pi}{dq} = 100 - 4q = 0\) \(q^* = 25\)

Step 2: Verify it’s a maximum using second derivative: \(\frac{d^2\Pi}{dq^2} = -4 < 0\) ✓ (maximum)

Step 3: Calculate maximum profit: \(\Pi(25) = 100(25) - 2(25)^2 - 500 = 2500 - 1250 - 500 = 750\)

Answer: Optimal quantity = 25 units, Maximum profit = $750

Grading: 3 points for derivative, 2 points for critical point, 2 points for verification, 3 points for maximum profit.

Question 2.4

Calculate the eigenvalues of the matrix \(A = \begin{bmatrix} 5 & 2 \\ 2 & 2 \end{bmatrix}\) and determine if it’s positive definite.

Sample Answer: Step 1: Characteristic equation: \(\det(A - \lambda I) = 0\) \((5-\lambda)(2-\lambda) - 4 = 0\) \(\lambda^2 - 7\lambda + 6 = 0\) \((\lambda - 6)(\lambda - 1) = 0\)

Step 2: Eigenvalues: \(\lambda_1 = 6, \lambda_2 = 1\)

Step 3: Since both eigenvalues are positive, the matrix is positive definite.

Grading: 4 points for characteristic equation, 3 points for eigenvalues, 3 points for conclusion.

Question 2.5

Create an R function to plot the utility function \(U(x,y) = x^{0.3}y^{0.7}\) and find the utility level when \(x = 4, y = 9\).

Sample Answer:

# Define utility function
utility <- function(x, y) {
  return(x^0.3 * y^0.7)
}

# Calculate utility at specific point
U_value <- utility(4, 9)
print(paste("Utility at (4,9):", round(U_value, 3)))

# Create contour plot
x <- seq(1, 10, length.out = 50)
y <- seq(1, 10, length.out = 50)
z <- outer(x, y, utility)

contour(x, y, z, main = "Utility Function U(x,y) = x^0.3 * y^0.7")
points(4, 9, col = "red", pch = 19)

Utility at (4,9): \(U = 4^{0.3} \times 9^{0.7} = 1.516 \times 6.240 = 9.460\)

Grading: 4 points for function definition, 3 points for calculation, 3 points for plotting code.

Question 2.6

Solve for the inverse function of \(f(x) = 3e^{2x} + 1\) and verify your answer.

Sample Answer: Step 1: Set \(y = 3e^{2x} + 1\) and solve for \(x\): \(y - 1 = 3e^{2x}\) \(\frac{y-1}{3} = e^{2x}\) \(\ln\left(\frac{y-1}{3}\right) = 2x\) \(x = \frac{1}{2}\ln\left(\frac{y-1}{3}\right)\)

Step 2: Inverse function: \(f^{-1}(x) = \frac{1}{2}\ln\left(\frac{x-1}{3}\right)\)

Step 3: Verification: \(f(f^{-1}(x)) = 3e^{2 \cdot \frac{1}{2}\ln\left(\frac{x-1}{3}\right)} + 1 = 3e^{\ln\left(\frac{x-1}{3}\right)} + 1 = 3 \cdot \frac{x-1}{3} + 1 = x\)

Grading: 5 points for solving process, 3 points for inverse function, 2 points for verification.

Level 3: Causal Understanding (Reasoning and Explanation)

Question 3.1

Explain why the covariance matrix in portfolio theory must be positive definite and what happens if it’s not.

Sample Answer: Why positive definite is required: Portfolio variance is \(\sigma_p^2 = \mathbf{w}^T\mathbf{\Sigma}\mathbf{w}\) where \(\mathbf{w}\) is the weight vector and \(\mathbf{\Sigma}\) is the covariance matrix. Since variance represents risk and must be non-negative, we need \(\mathbf{w}^T\mathbf{\Sigma}\mathbf{w} \geq 0\) for all possible weight vectors \(\mathbf{w}\).

If not positive definite: - Negative eigenvalues: Some portfolios would have negative variance (impossible) - Zero eigenvalues: Perfect correlation exists, reducing the effective dimension - Mathematical issues: Optimization algorithms may fail or give meaningless results

Economic interpretation: Non-positive definite covariance matrices indicate either data errors, perfect correlations, or insufficient diversification opportunities.

Grading: 4 points for mathematical reasoning, 3 points for consequences, 3 points for economic interpretation.

Question 3.2

Why do exponential functions appear frequently in business growth models? Explain the underlying economic reasoning.

Sample Answer: Mathematical reason: Exponential growth occurs when the rate of change is proportional to the current level: \(\frac{dN}{dt} = rN\), leading to \(N(t) = N_0 e^{rt}\).

Economic reasoning: 1. Network effects: Each new user attracts more users (social media, platforms) 2. Compound growth: Reinvestment of profits leads to accelerating returns 3. Learning curves: Efficiency improvements compound over time 4. Market penetration: Early adopters influence others exponentially

Limitations: Real growth eventually faces constraints (market saturation, competition), leading to logistic rather than pure exponential growth.

Examples: Technology adoption, viral marketing, compound interest, population growth in new markets.

Grading: 3 points for mathematical foundation, 4 points for economic reasoning, 3 points for limitations/examples.

Question 3.3

Explain why matrix inversion fails when the determinant is zero and what this means economically.

Sample Answer: Mathematical explanation: Matrix inversion requires \(A^{-1} = \frac{1}{\det(A)} \text{adj}(A)\). When \(\det(A) = 0\), division by zero makes inversion impossible.

Geometric interpretation: Zero determinant means the matrix transforms space into a lower dimension (columns are linearly dependent).

Economic meaning: 1. Redundant constraints: Some equations provide no new information 2. Inconsistent system: Constraints contradict each other (no feasible solution) 3. Perfect correlation: Variables are perfectly related, reducing degrees of freedom

Business example: If labor and material constraints are proportional (redundant), the system has infinite solutions along a line rather than a unique optimal point.

Solution approaches: Remove redundant constraints, use pseudo-inverse, or reformulate the problem.

Grading: 3 points for mathematical explanation, 4 points for economic interpretation, 3 points for business example.

Question 3.4

Why is the chain rule essential for analyzing composite functions in business applications?

Sample Answer: Mathematical necessity: Composite functions like \(R(t) = P(Q(t))\) (revenue as function of time through quantity) require the chain rule: \(\frac{dR}{dt} = \frac{dP}{dQ} \cdot \frac{dQ}{dt}\).

Business reasoning: 1. Indirect relationships: Many business variables affect outcomes through intermediate variables 2. Marginal analysis: Understanding how changes propagate through the system 3. Sensitivity analysis: Determining which factors have the greatest impact

Examples: - Revenue optimization: Price affects demand, which affects revenue - Cost management: Input prices affect production costs, which affect total costs - Growth analysis: Marketing affects user acquisition, which affects revenue

Strategic importance: Helps identify leverage points where small changes create large impacts.

Grading: 3 points for mathematical foundation, 4 points for business reasoning, 3 points for examples.

Question 3.5

Explain why multivariable functions require different visualization techniques and how each technique reveals different insights.

Sample Answer: Dimensional challenge: Functions of multiple variables create surfaces in higher dimensions that cannot be directly visualized in 2D.

Visualization techniques and insights: 1. 3D surfaces: Show overall shape and curvature, reveal optimization landscape 2. Contour plots: Show level sets (isoquants, indifference curves), reveal trade-offs 3. Heat maps: Highlight regions of interest, show gradients and patterns 4. Cross-sections: Analyze behavior when some variables are fixed 5. Gradient fields: Show direction of steepest increase, optimization paths

Business applications: - Production planning: Isoquants show input substitution possibilities - Portfolio optimization: Contours show risk-return trade-offs - Market analysis: Heat maps reveal profitable market segments

Strategic value: Different visualizations support different decision-making needs.

Grading: 3 points for dimensional explanation, 4 points for technique comparison, 3 points for business applications.

Question 3.6

Why do quadratic functions play a central role in optimization theory and business decision-making?

Sample Answer: Mathematical properties: 1. Second-order approximation: Taylor expansion shows any smooth function is locally quadratic 2. Unique optimum: Positive/negative definite quadratics have unique global optima 3. Analytical solutions: Quadratic optimization has closed-form solutions

Economic relevance: 1. Diminishing returns: Quadratic production functions capture decreasing marginal productivity 2. Risk modeling: Portfolio variance is quadratic in weights 3. Cost structures: Many cost functions exhibit quadratic behavior (economies/diseconomies of scale)

Business applications: - Profit maximization: Revenue often quadratic (price elasticity), costs often quadratic - Inventory management: Holding costs quadratic in inventory levels - Quality control: Deviation costs typically quadratic

Computational advantage: Quadratic programming is well-developed with efficient algorithms.

Grading: 3 points for mathematical properties, 4 points for economic relevance, 3 points for business applications.

Level 4: Predictive Understanding (Application and Extension)

Question 4.1

A tech startup’s user base grows according to \(U(t) = 1000e^{0.15t}\) (users after t months). If the company needs 50,000 users to attract Series A funding, predict when they should start fundraising preparations (assuming 6 months lead time).

Sample Answer: Step 1: Find when they reach 50,000 users \(50,000 = 1000e^{0.15t}\) \(50 = e^{0.15t}\) \(\ln(50) = 0.15t\) \(t = \frac{\ln(50)}{0.15} = \frac{3.912}{0.15} = 26.08\) months

Step 2: Account for 6-month preparation time Start fundraising at: \(26.08 - 6 = 20.08\) months ≈ 20 months

Step 3: Verify user count at start of fundraising \(U(20) = 1000e^{0.15 \times 20} = 1000e^3 = 20,086\) users

Prediction: Start fundraising preparations at month 20 when they have ~20,000 users, to reach 50,000 users by month 26 when funding closes.

Risk factors: Growth rate may change, market conditions, competition.

Grading: 4 points for calculation, 3 points for timing strategy, 3 points for verification/risk assessment.

Question 4.2

A company’s profit function is \(\Pi(p_1, p_2) = (p_1-10)(100-2p_1) + (p_2-15)(80-p_2)\). Predict the impact on total profit if market research suggests demand for product 1 will increase by 20%.

Sample Answer: Step 1: Current optimal prices \(\frac{\partial \Pi}{\partial p_1} = 100 - 4p_1 + 20 = 120 - 4p_1 = 0 \Rightarrow p_1^* = 30\) \(\frac{\partial \Pi}{\partial p_2} = 80 - 2p_2 + 15 = 95 - 2p_2 = 0 \Rightarrow p_2^* = 47.5\)

Current profit: \(\Pi(30, 47.5) = (20)(40) + (32.5)(32.5) = 800 + 1056.25 = 1856.25\)

Step 2: New demand function (20% increase) New: \(q_1 = 120 - 2p_1\) (instead of \(100 - 2p_1\)) New profit: \(\Pi_{new}(p_1, p_2) = (p_1-10)(120-2p_1) + (p_2-15)(80-p_2)\)

Step 3: New optimal prices \(\frac{\partial \Pi_{new}}{\partial p_1} = 120 - 4p_1 + 20 = 140 - 4p_1 = 0 \Rightarrow p_1^{new} = 35\) \(p_2\) unchanged: \(p_2^{new} = 47.5\)

Step 4: New profit \(\Pi_{new}(35, 47.5) = (25)(50) + (32.5)(32.5) = 1250 + 1056.25 = 2306.25\)

Prediction: Profit increases by $2306.25 - 1856.25 = \(450\) (24.2% increase)

Strategic implications: Higher optimal price for product 1, significant profit leverage from demand increases.

Grading: 4 points for current optimization, 3 points for new optimization, 3 points for impact analysis.

Question 4.3

Given a covariance matrix \(\Sigma = \begin{bmatrix} 0.04 & 0.02 \\ 0.02 & 0.09 \end{bmatrix}\) for two assets, predict the minimum variance portfolio and its risk level.

Sample Answer: Step 1: Verify positive definiteness Eigenvalues: \(\lambda = \frac{0.13 \pm \sqrt{0.0169 - 0.0144}}{2} = \frac{0.13 \pm 0.05}{2}\) \(\lambda_1 = 0.09, \lambda_2 = 0.04\) (both positive ✓)

Step 2: Minimum variance portfolio weights For two assets: \(w_1 = \frac{\sigma_2^2 - \sigma_{12}}{\sigma_1^2 + \sigma_2^2 - 2\sigma_{12}} = \frac{0.09 - 0.02}{0.04 + 0.09 - 2(0.02)} = \frac{0.07}{0.09} = 0.778\) \(w_2 = 1 - w_1 = 0.222\)

Step 3: Minimum variance \(\sigma_{min}^2 = w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2w_1w_2\sigma_{12}\) \(= (0.778)^2(0.04) + (0.222)^2(0.09) + 2(0.778)(0.222)(0.02)\) \(= 0.0242 + 0.0044 + 0.0069 = 0.0355\)

Prediction: - Optimal weights: 77.8% asset 1, 22.2% asset 2 - Minimum risk: \(\sqrt{0.0355} = 18.84\%\) standard deviation

Investment insight: Heavy weighting toward lower-variance asset, but diversification still reduces risk below either individual asset.

Grading: 3 points for verification, 4 points for calculation, 3 points for interpretation.

Question 4.4

A manufacturing company uses the production function \(Q(L,K) = 20L^{0.6}K^{0.4}\). If labor costs increase by 25%, predict the optimal adjustment in the labor-capital ratio and the impact on production costs.

Sample Answer: Step 1: Current optimal ratio (cost minimization) From \(\frac{MPL}{w} = \frac{MPK}{r}\): \(MPL = 12L^{-0.4}K^{0.4}\), \(MPK = 8L^{0.6}K^{-0.6}\) \(\frac{12L^{-0.4}K^{0.4}}{w} = \frac{8L^{0.6}K^{-0.6}}{r}\) \(\frac{K}{L} = \frac{2w}{3r}\)

Step 2: New ratio after 25% wage increase New wage: \(w_{new} = 1.25w\) \(\frac{K}{L}_{new} = \frac{2(1.25w)}{3r} = \frac{2.5w}{3r} = 1.25 \times \frac{2w}{3r}\)

Prediction: Capital-labor ratio increases by 25% (substitute capital for expensive labor)

Step 3: Cost impact For constant output \(Q_0\): \(L_{new} = L_0 \times (1.25)^{-0.4} = 0.871 \times L_0\) \(K_{new} = K_0 \times (1.25)^{0.6} = 1.147 \times K_0\)

New cost: \(C_{new} = 1.25w \times 0.871L_0 + r \times 1.147K_0 = 1.089wL_0 + 1.147rK_0\) If original cost was \(C_0 = wL_0 + rK_0\), cost increase depends on original labor share.

Strategic implications: Automate labor-intensive processes, invest in capital equipment.

Grading: 4 points for ratio calculation, 3 points for substitution analysis, 3 points for cost impact.

Question 4.5

Using the composite function \(R(t) = 50Q(t) - 0.1[Q(t)]^2\) where \(Q(t) = 100e^{0.05t}\), predict when revenue will start declining and the maximum revenue level.

Sample Answer: Step 1: Express revenue as function of time \(Q(t) = 100e^{0.05t}\) \(R(t) = 50(100e^{0.05t}) - 0.1(100e^{0.05t})^2 = 5000e^{0.05t} - 1000e^{0.1t}\)

Step 2: Find when revenue starts declining \(\frac{dR}{dt} = 5000(0.05)e^{0.05t} - 1000(0.1)e^{0.1t} = 250e^{0.05t} - 100e^{0.1t}\)

Set \(\frac{dR}{dt} = 0\): \(250e^{0.05t} = 100e^{0.1t}\) \(2.5 = e^{0.05t}\) \(t^* = \frac{\ln(2.5)}{0.05} = \frac{0.916}{0.05} = 18.32\) months

Step 3: Maximum revenue \(Q(18.32) = 100e^{0.05 \times 18.32} = 100 \times 2.5 = 250\) units \(R_{max} = 50(250) - 0.1(250)^2 = 12,500 - 6,250 = 6,250\)

Prediction: - Revenue peaks at month 18.3 - Maximum revenue: $6,250 - After month 18.3, revenue declines despite continued quantity growth (diminishing marginal revenue effect)

Business insight: Growth in quantity eventually hurts revenue due to price elasticity.

Grading: 4 points for derivative calculation, 3 points for optimization, 3 points for business interpretation.

Question 4.6

A portfolio manager has three assets with expected returns [8%, 12%, 15%] and wants to achieve 11% expected return. If the covariance matrix has eigenvalues [0.02, 0.05, 0.08], predict the portfolio’s risk characteristics.

Sample Answer: Step 1: Portfolio constraint \(w_1(0.08) + w_2(0.12) + w_3(0.15) = 0.11\) with \(w_1 + w_2 + w_3 = 1\)

This gives us: \(w_1(0.08) + w_2(0.12) + (1-w_1-w_2)(0.15) = 0.11\) \(0.08w_1 + 0.12w_2 + 0.15 - 0.15w_1 - 0.15w_2 = 0.11\) \(-0.07w_1 - 0.03w_2 = -0.04\) \(7w_1 + 3w_2 = 4\)

Step 2: Risk characteristics from eigenvalues All eigenvalues positive → covariance matrix is positive definite ✓ Risk range: \(\sqrt{0.02} = 14.1\%\) to \(\sqrt{0.08} = 28.3\%\)

Step 3: Efficient frontier position Target return (11%) is between lowest (8%) and highest (15%) returns. Expected risk level: approximately 16-22% (interpolated based on return level)

Prediction: - Portfolio is feasible (return target achievable) - Risk will be moderate (16-22% standard deviation) - Diversification benefits available (risk below highest individual asset) - Multiple weight combinations possible along constraint line

Strategic recommendation: Choose weights that minimize risk subject to return constraint.

Grading: 3 points for constraint setup, 4 points for risk analysis, 3 points for strategic insights.

Level 5: Empathic Understanding (Explaining to Others)

Question 5.1

You’re training a new analyst who asks: “Why do we use matrices for business problems when simple algebra seems easier?” Explain the advantages of matrix methods in a way that builds their intuition.

Sample Answer: Start with empathy: “Great question! I felt the same way when I started. Let me show you why matrices become your best friend in business analysis.”

Simple example: “Imagine you’re managing inventory for 3 products across 5 stores. That’s 15 variables! Writing 15 separate equations is messy and error-prone.”

Matrix advantage: 1. Organization: All information in one compact structure 2. Scalability: Same method works for 3 products or 300 products 3. Computer efficiency: Software can solve 1000×1000 systems instantly 4. Pattern recognition: Matrix properties reveal business insights

Concrete analogy: “Think of matrices like spreadsheets. You could do each calculation separately, but organizing data in rows and columns makes everything clearer and faster.”

Build confidence: “Once you see a few examples, you’ll wonder how you ever managed without matrices. They turn complex business problems into routine calculations.”

Next steps: “Let’s start with a simple 2×2 example and build up your comfort level.”

Grading: 3 points for empathy/connection, 4 points for clear explanation, 3 points for building confidence.

Question 5.2

A marketing manager is confused about composite functions: “Why can’t I just look at revenue directly instead of this complicated revenue-through-demand stuff?” Help them understand the business value.

Sample Answer: Acknowledge their perspective: “I understand the confusion! It does seem like extra complexity at first. But let me show you why this ‘complicated’ approach actually makes your job easier.”

Business reality: “In marketing, you don’t directly control revenue. You control things like advertising spend, which affects brand awareness, which affects demand, which affects revenue. That’s a composite function: Revenue(Demand(Advertising)).”

Why it matters: 1. Cause and effect: Shows how your actions create results 2. Optimization: Find the best advertising level, not just hope for good revenue 3. Prediction: “If I increase ad spend by $10k, what happens to revenue?” 4. Troubleshooting: When revenue drops, trace back through the chain

Practical example: “Say revenue drops 20%. Is it because: - Demand fell (market problem)? - Price changed (pricing problem)? - Conversion rate dropped (product problem)? Composite functions help you diagnose the real issue.”

Empowerment: “Once you master this, you’ll be the manager who can predict and control outcomes, not just react to them.”

Grading: 3 points for acknowledging confusion, 4 points for business relevance, 3 points for practical examples.

Question 5.3

An executive asks: “All these eigenvalues and positive definite stuff sounds like academic nonsense. What does it actually mean for my business?” Translate the concepts into executive language.

Sample Answer: Executive summary first: “Eigenvalues tell you if your business model is fundamentally sound or if there are hidden risks that could blow up.”

Real-world translation: - Positive definite = Stable business: All your risk factors point in the same direction. Diversification works. - Negative eigenvalues = Hidden danger: Some combinations of factors create impossible situations (like negative risk) - Zero eigenvalues = Redundancy: You’re measuring the same thing twice, wasting resources

Business examples: 1. Portfolio management: “Are your investments truly diversified, or are they all the same risk in disguise?” 2. Supply chain: “Are your suppliers independent, or would one disruption cascade through everything?” 3. Market research: “Are you asking different questions, or the same question five different ways?”

Bottom line: “Eigenvalues are like a business health check. They tell you if your strategy is mathematically sound before you bet the company on it.”

ROI argument: “Spending 30 minutes on eigenvalue analysis can save millions in failed strategies.”

Grading: 4 points for executive summary, 3 points for business translation, 3 points for ROI argument.

Question 5.4

A colleague struggles with multivariable functions: “I can barely handle one variable, and now you want me to think about three dimensions?” Guide them through building this skill progressively.

Sample Answer: Validate their concern: “You’re absolutely right to feel overwhelmed! Everyone struggles with this transition. Let’s build it step by step.”

Progressive approach: 1. Start familiar: “You already know multivariable thinking! When you buy a car, you consider price AND features AND reliability. That’s a 3D decision.”

  1. Visual building:
    • 1D: Line graph (price over time)
    • 2D: Scatter plot (price vs. features)
    • 3D: Add color for reliability
  2. Business intuition: “Profit depends on price AND quantity. You can’t optimize one without considering the other.”

Practical exercises: - Week 1: Fix one variable, plot the other (cross-sections) - Week 2: Contour plots (like topographic maps) - Week 3: Full 3D visualization

Confidence building: “Remember learning to drive? First you focused on steering, then added gas/brake, then traffic. Same principle here.”

Support system: “I’ll check in weekly, and we’ll tackle real business problems together. You’ll be surprised how quickly it clicks.”

Grading: 3 points for validation, 4 points for progressive approach, 3 points for ongoing support.

Question 5.5

A team member says: “I don’t understand why we need R when Excel can do calculations.” Help them see the value of programming for business analysis.

Sample Answer: Meet them where they are: “Excel is fantastic, and I use it daily! But let me show you when R becomes your superpower.”

Excel vs. R comparison: - Excel strength: Quick calculations, familiar interface, great for small datasets - R strength: Handles millions of rows, repeatable analysis, advanced statistics

When R shines: 1. Scale: “What takes 5 minutes in Excel takes 5 seconds in R with 100× more data” 2. Repeatability: “Write once, run monthly reports automatically” 3. Sophistication: “Advanced models that Excel simply can’t do” 4. Collaboration: “Share exact methods with colleagues worldwide”

Learning path: “Start by recreating your Excel analyses in R. Once you see the power, you’ll naturally want to learn more.”

Practical motivation: “Companies pay 20-30% more for analysts who can code. It’s an investment in your career.”

Reassurance: “You don’t need to become a programmer. Think of R as a very powerful calculator that remembers what you did.”

Grading: 3 points for respecting Excel, 4 points for clear comparison, 3 points for career motivation.

Question 5.6

A student asks: “Why do we need all this math theory when business is about people and relationships?” Help them connect mathematical rigor to business success.

Sample Answer: Honor their perspective: “You’re absolutely right that business is fundamentally about people! Math doesn’t replace human judgment—it amplifies it.”

Human-math connection: 1. Better decisions: “Math helps you understand patterns in human behavior that intuition might miss” 2. Fairness: “Objective analysis prevents bias in hiring, pricing, and resource allocation” 3. Communication: “Numbers provide a common language for diverse teams” 4. Credibility: “Stakeholders trust decisions backed by rigorous analysis”

Real examples: - Netflix: Math predicts what shows people will love - Uber: Algorithms match drivers with riders efficiently - Amazon: Recommendation engines understand customer preferences

The synthesis: “The best business leaders combine mathematical insight with human empathy. Math tells you what’s happening; wisdom tells you what to do about it.”

Career advantage: “In today’s data-driven world, leaders who can bridge math and people skills are incredibly valuable.”

Encouragement: “You’re not choosing between math and people—you’re learning to serve people better through mathematical understanding.”

Grading: 3 points for honoring perspective, 4 points for human-math connection, 3 points for career relevance.


Summary and Next Steps

This comprehensive Section 2 covers the essential mathematical foundations for business analysis:

  1. Linear systems and matrices - The backbone of resource allocation and constraint optimization
  2. Matrix inversion - Solving complex business systems efficiently
  3. Composite and inverse functions - Understanding indirect relationships and growth models
  4. R programming for univariable functions - Practical tools for economic analysis
  5. Multivariable function visualization - Advanced decision-making with multiple factors
  6. Quadratic forms and positive definite matrices - Risk analysis and optimization theory

Preparation for Section 3: These tools provide the foundation for understanding derivatives, which measure rates of change and enable optimization in business contexts.

Key Takeaways: - Mathematics provides powerful tools for business decision-making - Multiple representations (algebraic, graphical, computational) enhance understanding - R programming enables sophisticated analysis of real business problems - Interactive learning reinforces theoretical concepts with practical applications


Total estimated lecture time: 90 minutes Interactive elements: 6 quizzes + 6 R environments Assessment: 30 comprehensive questions across 5 levels of understanding